<?php
namespace Framework\Library\Utility;

/**
 * 分页参数生成类
 */
class PagingParameter{
	
	public $orderField = 'id';
	public $orderPattern = 'asc';
	public $pageSize = '10';
	public $pagePosition = 1;
	
	public $orderFieldIndex = 0;
	public $orderPatternIndex = 1;
	public $pageSizeIndex = 2;
	public $pagePositionIndex = 3;
	
	public function init($request){
		
		if (isset($request->params[$this->orderFieldIndex])) $this ->orderField = $request->params[$this->orderFieldIndex];
		if (isset($request->params[$this->orderPatternIndex]))$this ->orderPattern = $request->params[$this->orderPatternIndex];
		if (isset($request->params[$this->pageSizeIndex]))$this ->pageSize = $request->params[$this->pageSizeIndex];
		if (isset($request->params[$this->pagePositionIndex]))$this ->pagePosition = $request->params[$this->pagePositionIndex];
		
	}
	
}